import { systemManagementInfo } from '#/systemManagement'
import { workBenchInfo } from '#/workBench'

export const rawModuleList = [
    {
        label: '系统管理',
        value: 'systemManagement',
        info: systemManagementInfo
    },
    {
        label: '工作台',
        value: 'workBench',
        info: workBenchInfo
    }
]

export const moduleComponentList = []

export const moduleTreeList = rawModuleList.map(_moduleInfo => {
    const { label, value, info } = _moduleInfo
    const moduleInfo = {
        label,
        value,
        children: info.componentList.map(_componentInfo => {
            const { description, componentName, component } = _componentInfo
            const componentInfo = {
                label: description,
                value: `${value}##${componentName}`,
                moduleName: value,
                componentName,
                component
            }
            moduleComponentList.push(componentInfo)
            return componentInfo
        })
    }
    return moduleInfo
})

export const moduleComponentMap = moduleComponentList.reduce((prev, current) => {
    prev[current.value] = current
    return prev
}, {})